package global

import (
	"go.mongodb.org/mongo-driver/mongo"
)

var (
	DBEngine  *mongo.Client
	DBName    string
	DBConnect string
)

// Response 封装全局返回类型
type Response struct {
	Code int         `json:"code"`
	Data interface{} `json:"data"`
	Msg  string      `json:"msg"`
}

func Success(data interface{}) Response {
	var res Response
	res.Code = 200
	res.Data = data
	res.Msg = "success"
	return res
}

func Fail(msg string) Response {
	var res Response
	res.Code = 500
	res.Msg = msg
	return res
}
